package learnjava.basic.other;

import java.util.Calendar;

public class TestCalendar {

    public static void main(String[] args) {

        //查看任何一年的二月多少天
        int year = 2004;
        Calendar calendar = Calendar.getInstance();
        calendar.set(year,2,1);//month从0开始
        calendar.add(Calendar.DAY_OF_MONTH,-1);
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));

    }
}
